Management of data storage in analog memory cells using a non-integer number of bits per cell

ABSTRACT

A method for data storage includes storing data in a group of memory cells, by encoding the data using at least an outer code and an inner code, and optionally inverting the encoded data prior to storing the encoded data in the memory cells. The encoded data is read from the memory cells, and inner code decoding is applied to the read encoded data to produce a decoding result. At least part of the read data is conditionally inverted, depending on the decoding result of the inner code.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to a U.S. patent application entitled“Storage Management in Analog Memory Cells using a Non-Integer Number ofBits Per Cell,” U.S. application Ser. No. 14/135,881, filed Dec. 20,2013, whose disclosure is incorporated herein by reference.

FIELD OF THE INVENTION

The present invention relates generally to data storage, andparticularly to methods and systems for storing data in analog memorycells.

BACKGROUND OF THE INVENTION

Several types of memory devices, such as Flash memories, use arrays ofanalog memory cells for storing data. Each analog memory cell stores aquantity of an analog value, also referred to as a storage value, suchas an electrical charge or voltage. This analog value represents theinformation stored in the cell. In Flash memories, for example, eachanalog memory cell holds a certain amount of electrical charge. Therange of possible analog values is typically divided into intervals,each interval corresponding to one or more data bit values. Data iswritten to an analog memory cell by writing a nominal analog value thatcorresponds to the desired bit or bits.

Some memory devices, commonly referred to as Single-Level Cell (SLC)devices, store a single bit of information in each memory cell, i.e.,each memory cell can be programmed to assume two possible programminglevels. Higher-density devices, often referred to as Multi-Level Cell(MLC) devices, store two or more bits per memory cell, i.e., can beprogrammed to assume more than two possible programming levels. As anexample, a Triple-Level Cell (TLC) device, stores three bits per cellusing eight programming levels.

Flash memory devices are described, for example, by Bez et al., in“Introduction to Flash Memory,” Proceedings of the IEEE, volume 91,number 4, April, 2003, pages 489-502, which is incorporated herein byreference. Multi-level Flash cells and devices are described, forexample, by Eitan et al., in “Multilevel Flash Cells and theirTrade-Offs,” Proceedings of the 1996 IEEE International Electron DevicesMeeting (IEDM), New York, N.Y., pages 169-172, which is incorporatedherein by reference. The paper compares several kinds of multilevelFlash cells, such as common ground, DINOR, AND, NOR and NAND cells.

Eitan et al., describe another type of analog memory cell called NitrideRead Only Memory (NROM) in “Can NROM, a 2-bit, Trapping Storage NVMCell, Give a Real Challenge to Floating Gate Cells?” Proceedings of the1999 International Conference on Solid State Devices and Materials(SSDM), Tokyo, Japan, Sep. 21-24, 1999, pages 522-524, which isincorporated herein by reference. NROM cells are also described byMaayan et al., in “A 512 Mb NROM Flash Data Storage Memory with 8 MB/sData Rate,” Proceedings of the 2002 IEEE International Solid-StateCircuits Conference (ISSCC 2002), San Francisco, Calif., Feb. 3-7, 2002,pages 100-101, which is incorporated herein by reference. Otherexemplary types of analog memory cells are Floating Gate (FG) cells,Ferroelectric RAM (FRAM) cells, magnetic RAM (MRAM) cells, Charge TrapFlash (CTF) and phase change RAM (PRAM, also referred to as Phase ChangeMemory—PCM) cells. FRAM, MRAM and PRAM cells are described, for example,by Kim and Koh in “Future Memory Technology including Emerging NewMemories,” Proceedings of the 24^(th) International Conference onMicroelectronics (MIEL), Nis, Serbia and Montenegro, May 16-19, 2004,volume 1, pages 377-384, which is incorporated herein by reference.

Some storage schemes store data at a density having a non-integer numberof bits per memory cell. For example, U.S. Pat. No. 7,071,849, whosedisclosure is incorporated herein by reference, describes fractional-bitsystems that allow increments of the number of states per cell by aslittle as one between product generations. Since the number of statesper cell is not an integer power of two, the number of bits per celltakes a fractional value. Cells are typically decoded in units of word,and the system efficiency can be optimized by adjusting the word-width.

As another example, U.S. Pat. No. 6,646,913, whose disclosure isincorporated herein by reference, describes a method for storing andreading data in a multilevel nonvolatile memory having a memory arrayformed by a plurality of memory cells. Each of the memory cells stores anumber of bits that is not an integer power of two. In this way, onedata byte is stored in a non-integer number of memory cells. Themanaging method includes storing, in the same clock cycle, a data wordformed by a plurality of bytes, by programming a preset number ofadjacent memory cells. Reading is performed by reading the stored dataword in the same clock cycle.

The method described in U.S. Pat. No. 7,167,109, whose disclosure isincorporated herein by reference, allows increments of the number ofstates-per-cell N by as little as 1 between product generations. BecauseN is no longer an integral power of two, b takes a fractional value,resulting in a fractional-bit system. In a fractional-bit system, cellsare decoded in units of word. By adjusting the word-width, the systemefficiency can be optimized. Hybrid N-ary system can be used to improvemanufacturing yield and endurance lifetime.

U.S. Pat. No. 7,742,335, whose disclosure is incorporated herein byreference, describes methods, devices, modules, and systems foroperating non-volatile multilevel memory cells. One method embodimentincludes assigning, to a first cell coupled to a row select line, afirst number of program states to which the first cell can beprogrammed. The method further includes assigning, to a second cellcoupled to the row select line, a second number of program states towhich the second cell can be programmed, wherein the second number ofprogram states is greater than the first number of program states. Themethod includes programming the first cell to one of the first number ofprogram states prior to programming the second cell to one of the secondnumber of program states.

U.S. Pat. No. 7,848,142, whose disclosure is incorporated herein byreference, describes methods, devices, modules, and systems forprogramming memory cells that can include storing charges correspondingto a data state that represents an integer number of bits in a set ofmemory cells. Programming memory cells can include storing a charge in acell of the set, where the charge corresponds to a programmed state,where the programmed state represents a fractional number of bits, andwhere the programmed state denotes a digit of the data state asexpressed by a number in base N, where N is equal to 2^(B), rounded upto an integer, and where B is equal to the fractional number of bitsrepresented by the programmed state.

U.S. Pat. No. 7,420,841, whose disclosure is incorporated herein byreference, describes a memory device and a method of operating a memorydevice. In one embodiment of the invention, the memory device includes aplurality of multi-level memory cells each having a number m of levelsnot matching 2^(n) with n being a non-zero integer, and a circuit ordevice for combining the levels of at least two of the memory cells forwrite and read operations into a set of combined states and fortransforming at least a subset of 2^(n) combinations of the set ofcombined states into n two-level data bits.

SUMMARY OF THE INVENTION

An embodiment of the present invention that is described herein providesa method for data storage, including storing data in a group of memorycells by encoding the data using at least an outer code and an innercode, and optionally inverting the encoded data prior to storing theencoded data in the memory cells. The encoded data is read from thememory cells. Inner code decoding is applied to the read encoded data toproduce a decoding result. At least part of the read data isconditionally inverted depending on the decoding result of the innercode.

In some embodiments, the inner code includes a code in which inversionof a valid code word does not always result in another valid code word,and applying the inner code decoding includes decoding at least one ofthe read encoded data and an inverted version of the read encoded data.In other embodiments, applying the inner code decoding includes decodingboth the read encoded data and the inverted version of the read encodeddata, and conditionally inverting the at least part of the read dataincludes inverting the at least part of the read data only when thedecoding result of the inverted version is error free and the decodingresult of the read encoded data is not error free.

In yet other embodiments, storing the data includes storing withrelation to the data an inversion indication of whether the stored datahas been inverted, reading the encoded data includes reading anddecoding the inversion indication, and applying the inner code decodingincludes decoding only the read encoded data or only the invertedversion of the read encoded data, depending on the inversion indication.

In an embodiment, conditionally inverting the at least part of the readdata includes indicating inability to decide whether to invert the readdata when the decoding result of the read encoded data contradicts theinversion indication. In another embodiment, the inner code includes anerror detection code, and conditionally inverting the at least part ofthe read data includes inverting the at least part of the read data whenthe decoding result is equal to a result of applying the inner codedecoding to an all-ones word, and not inverting the at least part of theread data when the decoding result is error free.

In yet another embodiment, conditionally inverting the at least part ofthe read data includes indicating inability to decide whether to invertthe read data or not, when the decoding result of the read encoded datacontradicts the decoding result of the inverted version of the readencoded data.

There is additionally provided, in accordance with an embodiment of thepresent invention, apparatus including a memory, which includes an arrayof memory cells, and storage circuitry. The storage circuitry isconfigured to store data in a group of the memory cells, by encoding thedata using at least an outer code and an inner code and optionallyinverting the encoded data prior to storing the encoded data in thememory cells, to read the encoded data from the memory cells, to applyinner code decoding to the read encoded data to produce a decodingresult, and to conditionally invert at least part of the read datadepending on the decoding result of the inner code.

There is additionally provided, in accordance with an embodiment of thepresent invention, a method for data storage including, in a firstprogramming phase, storing first data in a group of memory cells byprogramming the memory cells in the group to a set of initialprogramming levels. In a second programming phase that is subsequent tothe first programming phase, second data is stored in the group byidentifying the memory cells in the group that were programmed in thefirst programming phase to respective levels in a predefined partialsubset of the initial programming levels. Only the identified memorycells are programmed with the second data, so as to set at least some ofthe identified memory cells to one or more additional programming levelsthat are different from the initial programming levels. The memory cellsto which the second data was programmed are recognized by reading only apartial subset of the first data. The second data is read from therecognized memory cells.

In some embodiments, storing the first data includes storing multipledata pages, and recognizing the memory cells includes reading only apartial subset of the multiple pages. In other embodiments, storing thefirst data includes storing a Least Significant Bit (LSB) page and aCentral Significant Bit (CSB) page, and storing the second data includesstoring a Most Significant Bit (MSB) page, and recognizing the memorycells includes reading only the LSB page or the CSB page. In yet otherembodiments, reading the LSB page or the CSB page includes reading theLSB page or the CSB page using a single read command. In further yetother embodiments, reading the second data includes reading the MSB pagefrom the recognized memory cells using two reading thresholds.

There is additionally provided, in accordance with an embodiment of thepresent invention, apparatus for data storage including a memory, whichincludes an array of memory cells, and storage circuitry. The storagecircuitry is configured to store first data in a group of the memorycells in a first programming phase by programming the memory cells inthe group to a set of initial programming levels, and, in a secondprogramming phase that is subsequent to the first programming phase, tostore second data in the group by identifying the memory cells in thegroup that were programmed in the first programming phase to respectivelevels in a predefined partial subset of the initial programming levels,and programming only the identified memory cells with the second data,so as to set at least some of the identified memory cells to one or moreadditional programming levels that are different from the initialprogramming levels, to recognize the memory cells to which the seconddata was programmed, by reading only a partial subset of the first data,and to read the second data from the recognized memory cells.

There is additionally provided, in accordance with an embodiment of thepresent invention, a method for data storage, including, in a group ofmemory cells, identifying an expected number of the memory cells in thegroup that are to be programmed to a given programming state. Aseparation between the given programming state and a neighboringprogramming state is set depending on the expected number of the memorycells to be programmed to the given programming state. The memory cellsin the group are programmed using the set separation.

In some embodiments, the neighboring programming state is created bysplitting the given programming state according to a predefinedsplitting ratio, and identifying the expected number of the memory cellsincludes evaluating the number of the memory cells programmed to thegiven programming level using the splitting ratio. In other embodiments,programming the memory cells includes setting the memory cells tomultiple memory states, such that respective separations betweenneighboring memory states are non-uniform.

There is additionally provided, in accordance with an embodiment of thepresent invention, apparatus for data storage including a memory, whichincludes an array of memory cells, and storage circuitry. The storagecircuitry is configured to identify in a group of the memory cells anexpected number of the memory cells in the group that are to beprogrammed to a given programming state, to set a separation between thegiven programming state and a neighboring programming state depending onthe expected number of the memory cells to be programmed to the givenprogramming state, and to program the memory cells in the group usingthe set separation.

There is additionally provided, in accordance with an embodiment of thepresent invention, a method for data storage, including, in a firstprogramming phase, storing first data in multiple groups of memory cellsby programming the memory cells in each group to a respective set ofinitial programming levels. In a second programming phase that issubsequent to the first programming phase, second data is stored in themultiple groups by identifying available memory cells in each group thatwere programmed in the first programming phase to respective levels in apredefined partial subset of the initial programming levels. Only theidentified available memory cells are programmed with the second data,such that the second data of a given group is programmed starting from afixed location in the groups of the memory cells regardless ofvariations in the actual number of the available memory cells, so as toset at least some of the available memory cells to one or moreadditional programming levels that are different from the initialprogramming levels.

In some embodiments, the method includes reading the second data of thegiven group by accessing the memory cells at the fixed location. Inother embodiments, the second data includes multiple data words, and thesize of each data word is larger than the actual number of the availablecells in each of the multiple groups of the memory cells. In yet otherembodiments, reading the second data includes reading a given data wordof the multiple data words by reading the first data only from one ormore groups of the memory cells in which the given data word wasprogrammed.

In an embodiment, the method includes programming the un-programmedmemory cells with third data when programming the identified availablecells with the second data leaves one or more of the identifiedavailable cells un-programmed. In another embodiment, the second dataincludes multiple data words whose data-word size does not exceed thenumber of available memory cells in each of the multiple groups ofmemory cells.

There is additionally provided, in accordance with an embodiment of thepresent invention, apparatus for data storage, including a memory, whichincludes an array of memory cells, and storage circuitry. The storagecircuitry is configured to store first data in multiple groups of thememory cells in a first programming phase by programming the memorycells in each group to a respective set of initial programming levels,and, in a second programming phase that is subsequent to the firstprogramming phase, to store second data in the multiple groups byidentifying available memory cells in each group that were programmed inthe first programming phase to respective levels in a predefined partialsubset of the initial programming levels, and programming only theidentified available memory cells with the second data, such that thesecond data of a given group is programmed starting from a fixedlocation in the groups of the memory cells regardless of variations inthe actual number of the available memory cells, so as to set at leastsome of the available memory cells to one or more additional programminglevels that are different from the initial programming levels.

The present invention will be more fully understood from the followingdetailed description of the embodiments thereof, taken together with thedrawings in which:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that schematically illustrates a memorysystem, in accordance with an embodiment of the present invention;

FIG. 2 is a diagram that schematically illustrates a data code word, inaccordance with an embodiment of the present invention;

FIGS. 3A and 3B are graphs showing the distribution of programminglevels used for storing data with a non-integer number of bits per cell,in accordance with embodiments of the present invention;

FIGS. 4A and 4B are diagrams that schematically illustrate twotechniques for storing data at known offsets among available memorycells, in accordance with embodiments of the present invention;

FIG. 5 is a flow chart that schematically illustrates a method forwriting data at known offsets among available memory cells, inaccordance with an embodiment of the present invention; and

FIG. 6 is a flow chart that schematically illustrates a method forreading data, which was written at known offsets among available memorycells, in accordance with an embodiment of the present invention.

DETAILED DESCRIPTION OF EMBODIMENTS Overview

Storing data using a non-integer number of bits per cell can beadvantageous over using an integer number, since it enables to improvethe storage density or reliability, using an increased or decreasednumber of programming levels, respectively, without limiting the totalnumber of levels to be an integer power of two.

Embodiments of the present invention provide improved methods andsystems for managing the storage of data using a non-integer number ofbits per memory cell. The disclosed embodiments employ several variantsof a two-phase programming scheme. Various examples of such two-phaseprogramming schemes are described, for example, in U.S. patentapplication Ser. No. 13/192,501, filed Jul. 28, 2011, which is assignedto the assignee of the present patent application and whose disclosureis incorporated herein by reference. In such schemes, in the firstprogramming phase the memory cells are programmed using a number ofprogramming levels that is an integer power of two. In the secondprogramming phase, an additional bit is stored only in cells that wereeach programmed in the first phase to a level in a group of one or moreselected levels. These cells are suitable for programming in the secondphase and are also referred to herein as “available cells”.

The exact number of available cells is data-dependent and thereforevariable. Therefore, in some embodiments, data pages that are written inthe first phase are optionally bit-flipped (i.e., the polarity of thebits is inverted) to ensure sufficient number of available cells forstoring the second-phase data. Bit-flipping, however, may be problematicwhen the data is subjected to an error correction and/or error detectioncodes, in which an inverted valid code word is not necessarily also avalid code word. Examples of codes that do not guarantee mapping of eachinverted code word to another valid code word include Cyclic RedundancyCode (CRC) and Bose-Chaudhuri-Hocquenghem (BCH). In an embodiment, acoding scheme employs inner and outer codes. The inner code (e.g., CRCor BCH) may be used in conjunction with the outer code (e.g., LowDensity Parity Check—LDPC), for example, to recognize conditions forearly termination of the iterative LDPC decoder or for resolvingtrapping-set scenarios. In some embodiments, the polarity of the storedcode word is indicated by a respective inversion bit, which is typically(although not necessarily) embedded in the code word.

In an embodiment, the inner code comprises an error detecting code suchas CRC code (or BCH code in error detection mode). Data is read from thememory cells, the outer code is decoded, and CRC decoding is applied(possibly in parallel to the outer decoder) to both the data read and tothe same data inverted. The polarity is determined based on whethereither of the CRC decoding indicates that no errors were found, (andpossibly on the inversion bit). In another embodiment, CRC decoding isapplied only once, according to the polarity of the inversion bit in theread data. In yet another embodiment, the outcome of the CRC decoder iscompared to both a zero word (indicating no inversion) and to a word,which is equal to the CRC applied to an all-ones word (indicating thatinversion was applied). In yet further another embodiment, the innercode comprises an error correction code, such as a BCH code (configuredto error correction operating mode), and decoding is applied to both theread data and to the same data inverted. The polarity of the code wordis determined according to whether the outcome of any of the two BCHdecoders is decodable, i.e., is error free.

In some embodiments, each memory cell is programmed in the first phase(of the above-mentioned two-phase programming scheme) to assume one offour initial levels, two of which are selected for the second phase. Inthe second phase, an additional bit is written only to cells that wereprogrammed to one of the two selected levels. The cell occupancies ofthe selected levels are thus split in about half in the second phase,resulting in a total number of six levels, of which four areapproximately half populated. Since according to this scheme half of thecells store 3 bits/cell and the other half store 2 bits/cell, the devicestores an average number of 2.5 bits/cell.

In the disclosed embodiments, which employ a six-level programmingscheme as described above, dedicated schemes for mapping three-bitcombinations to programming levels are designed to enable identificationof cells programmed in the second phase without the need to read theentire data programmed in the first phase. In one embodiment,identifying the cells is performed by reading only the centralsignificance bit (CSB) page using two read thresholds. In anotherembodiment, identifying the cells involves reading only the leastsignificant (LSB) bit page using a single read threshold. The disclosedtechniques thus refrain from unnecessary operations of read and decode.

In some embodiments, instead of uniform level spacing, thethreshold-voltage spacing among the programming levels is determinedbased on the cell occupancy of the levels. In such embodiments, thespacing or separation between adjacent levels that are less occupied isset closer than the spacing between adjacent levels that are highlyoccupied. Such non-uniform spacing may be used, for example, to achieveuniform read error probability across all the levels.

In some embodiments, N-bit sized words (e.g., N-bit code words ofencoded data) are written to groups of N cells, which are also referredto as cell-groups. In such embodiments, optional bit inversion isapplied prior to storing in the first phase to ensure sufficient leveloccupancy (i.e., sufficient number of available cells) in the secondphase, as described above. If in addition, three levels (out of fourlevels used in the first phase) are split in the second phase, onlyabout ¾ of the cells in each cell-group are available for storing anadditional bit. In some embodiments, three N-bit code words are storedamong the available cells of four cell-groups. Each code word is dividedinto two segments, which are written in two separate cell-groups atcertain fixed offsets among the available cells.

In an example embodiment, the segments of the code words are written insequence, using up all the available cells. In this embodiment, theoffset among the available cells in which each segment is written isdata dependent. To read a code word, the offsets of the respectivesegments are evaluated by reading data from at least cell-groups inwhich none of the respective segments are written.

In other embodiments, the segments of the code words are written atknown fixed offsets among the available cells in each cell-group. Byusing fixed offsets, reading the segments of a given code word requiresreading data only from the cell-groups in which the segments of thatcode word are written. The read segments are then combined to recoverthe original code word. Using known offsets thus enables to refrain fromunnecessary operations of read and decode.

In other embodiments, the data-size in the second phase is selected tofit the minimal number of available cells in the cell-groups, andtherefore simplifies the operations of data read and write. In suchembodiments, however, separate different coding schemes may be requiredfor the first and second programming phases, thus making the overallcoding scheme more complex.

System Description

FIG. 1 is a block diagram that schematically illustrates a memory system20, in accordance with an embodiment of the present invention. System 20can be used in various host systems and devices, such as in computingdevices, cellular phones or other communication terminals, removablememory modules (e.g., “disk-on-key” or “Flash drive” devices), SolidState Disks (SSD), digital cameras, music and other media players and/orany other system or device in which data is stored and retrieved.

System 20 comprises a memory device 24, which stores data in a memorycell array 28. The memory array comprises multiple analog memory cells32. In the context of the present patent application and in the claims,the term “analog memory cell” is used to describe any memory cell thatholds a continuous, analog value of a physical parameter, such as anelectrical voltage or charge. Array 32 may comprise solid-state analogmemory cells of any kind, such as, for example, NAND, NOR and ChargeTrap Flash (CTF) Flash cells, phase change RAM (PRAM, also referred toas Phase Change Memory—PCM), Nitride Read Only Memory (NROM),Ferroelectric RAM (FRAM), magnetic RAM (MRAM) and/or Dynamic RAM (DRAM)cells. Although the embodiments described herein refer mainly to analogmemory, the disclosed techniques may also be used with various othermemory types.

The charge levels stored in the cells and/or the analog voltages orcurrents written into and read out of the cells are referred to hereincollectively as analog values, storage values or analog storage values.Although the embodiments described herein mainly address thresholdvoltages, the methods and systems described herein may be used with anyother suitable kind of storage values.

System 20 stores data in the analog memory cells by programming thecells to assume respective memory states, which are also referred to asprogramming levels. The programming levels are selected from a finiteset of possible levels, and each level corresponds to a certain nominalstorage value. For example, a 2 bit/cell MLC can be programmed to assumeone of four possible programming levels by writing one of four possiblenominal storage values into the cell. The techniques described hereinmainly address storage densities of a non-integer number of bits permemory cell, i.e., a number of programming levels that is not an integerpower of two.

Memory device 24 comprises a reading/writing (R/W) unit 36, whichconverts data for storage in the memory device to analog storage valuesand writes them into memory cells 32. In alternative embodiments, theR/W unit does not perform the conversion, but is provided with voltagesamples, i.e., with the storage values for storage in the cells. Whenreading data out of array 28, R/W unit 36 converts the storage values ofmemory cells 32 into digital samples having an integer resolution of oneor more bits. Data is typically written to and read from the memorycells in groups that are referred to as pages. In some embodiments, theR/W unit can erase a group of cells 32 by applying one or more negativeerasure pulses to the cells.

The storage and retrieval of data in and out of memory device 24 isperformed by a memory controller 40. Memory controller 40 comprises aninterface 44 for communicating with memory device 24, a processor 48,and an Error Correcting Code (ECC) unit 50. The disclosed techniques canbe carried out by memory controller 40, by R/W unit 36, or both. Thus,in the present context, memory controller 40 and R/W unit 36 arereferred to collectively as storage circuitry that carries out thedisclosed techniques.

Memory controller 40 communicates with a host 52, for accepting data forstorage in the memory device and for outputting data retrieved from thememory device. ECC unit 50 encodes the data for storage using a suitableECC and decodes the ECC of data retrieved from the memory. Any suitabletype of ECC, such as, for example, Low Density Parity Check (LDPC),Reed-Solomon (RS) or Bose-Chaudhuri-Hocquenghem (BCH), can be used. Insome embodiments, in addition to comprising an error correcting code,ECC unit 50 further comprises another (typically smaller) errorcorrecting or error detecting code. Example codes that may be used forsuch additional code include BCH for error correction and CyclicRedundancy Code (CRC) for error detection. The output of ECC unit 50 inthe encode direction is also referred to as a “code word.”

Memory controller 40 may be implemented in hardware, e.g., using one ormore Application-Specific Integrated Circuits (ASICs) orField-Programmable Gate Arrays (FPGAs). Alternatively, the memorycontroller may comprise a microprocessor that runs suitable software, ora combination of hardware and software elements.

The configuration of FIG. 1 is an example system configuration, which isshown purely for the sake of conceptual clarity. Any other suitablememory system configuration can also be used. For example, although theexample of FIG. 1 shows a single memory device, in alternativeembodiments memory controller 40 may control multiple memory devices 24.Elements that are not necessary for understanding the principles of thepresent invention, such as various interfaces, addressing circuits,timing and sequencing circuits and debugging circuits, have been omittedfrom the figure for clarity.

In the example system configuration shown in FIG. 1, memory device 24and memory controller 40 are implemented as two separate IntegratedCircuits (ICs). In alternative embodiments, however, the memory deviceand the memory controller may be integrated on separate semiconductordies in a single Multi-Chip Package (MCP) or System on Chip (SoC), andmay be interconnected by an internal bus. Further alternatively, some orall of the memory controller circuitry may reside on the same die onwhich the memory array is disposed. Further alternatively, some or allof the functionality of memory controller 40 can be implemented insoftware and carried out by a processor or other element of the hostsystem. In some embodiments, host 44 and memory controller 40 may befabricated on the same die, or on separate dies in the same devicepackage.

In some embodiments, memory controller 40 comprises a general-purposeprocessor, which is programmed in software to carry out the functionsdescribed herein. The software may be downloaded to the processor inelectronic form, over a network, for example, or it may, alternativelyor additionally, be provided and/or stored on non-transitory tangiblemedia, such as magnetic, optical, or electronic memory.

In an example configuration of array 28, memory cells 32 are arranged inmultiple rows and columns, and each memory cell comprises afloating-gate transistor. The gates of the transistors in each row areconnected by word lines, and the sources of the transistors in eachcolumn are connected by bit lines. In the present context, the term“row” is used in the conventional sense to mean a group of memory cellsthat are fed by a common word line, and the term “column” means a groupof memory cells fed by a common bit line. The terms “row” and “column”do not connote a certain physical orientation of the memory cellsrelative to the memory device. The memory array is typically dividedinto multiple memory pages, i.e., groups of memory cells that areprogrammed and read simultaneously.

In some embodiments, memory pages are sub-divided into sectors. Pagesmay be mapped to word lines in various manners. Each word line may storeone or more pages. A given page may be stored in all the memory cells ofa word line, or in a subset of the memory cells (e.g., the odd-order oreven-order memory cells).

Erasing of cells is usually carried out in blocks that contain multiplepages. Typical memory devices may comprise thousands of erasure blocks.In a typical two-bit-per-cell MLC device, each erasure block is on theorder of 32 word lines, each comprising several tens of thousands ofcells. Each word line of such a device is often partitioned into fourpages (odd/even order cells, least/most significant bit of the cells).Three-bit-per cell devices having 32 word lines per erasure block wouldhave 192 pages per erasure block, and four-bit-per-cell devices wouldhave 256 pages per block. Alternatively, other block sizes andconfigurations can also be used. Some memory devices comprise two ormore separate memory cell arrays, often referred to as planes. Sinceeach plane has a certain “busy” period between successive writeoperations, data can be written alternately to the different planes inorder to increase programming speed.

Storing Data Using a Non-Integer Number of Bits Per Cell

Storing data using a non-integer number of bits per cell is equivalentto programming the memory cells to assume programming levels or stateswhose number is not an integer power of two. In some embodiments, system20 employs a two-phase programming scheme to store the data using anon-integer number of bits per cell.

In the first phase, the memory cells are programmed using a number ofprogramming levels that is an integer power of two. For example, in aTLC device, the cells are first programmed using only four levels (outof the eight possible levels). In the second phase, only cells that wereprogrammed in the first phase to certain levels among the first phaselevels may be programmed with an additional bit. In the eight-level TLCexample, the first phase levels, which are selected for programming inthe second phase, comprise a group of one, two, or three levels,resulting in a total number of five, six, or seven levels, respectively.

In the second phase, the value (“0” or “1”) of the additional bitdetermines whether the respective cell retains the programming level towhich the cell was programmed in the first phase, or programmed toanother, typically higher, programming level, which differs from all thelevels of the first phase. Thus, a programming level, which waspopulated with a given number of cells in the first phase, is split inthe second phase approximately in half, assuming similar “0” and “1” bitprevalence. Various examples of such two-phase programming schemes aredescribed, for example, in U.S. patent application Ser. No. 13/192,501,cited above.

In some embodiments, the data to be programmed comprises separate datapages, e.g., pages of orderly bit significance. The storage circuitrystores the pages of bit significance lower than the highest (or most)significant bit in the first phase, and only the most significant datapage in the second phase. For example, in a TLC device, the storagecircuitry stores Least Significant Bit (LSB) and Central Significant Bit(CSB) pages in the first phase. Then, based on the data stored in thefirst phase, the storage circuitry stores a Most Significant Bit (MSB)page during the second phase. Examples of first and second phaseprogramming levels, level splitting, and mapping schemes of bitcombinations to programming levels are described below with relation toFIGS. 3A and 3B.

Methods for Decoding Inverted Code Words

When programming data in the second phase (e.g., MSB data), theaggregated number of cells that populate the programming levels to besplit is data dependent, and may be found insufficient. In someembodiments, the bit polarity of the data pages written in the firstphase is optionally inverted to ensure sufficient cell population of thelevels to be split in the second phase. When, in addition, the data issubject to error correction coding, conventional decoding of theinverted data may not be feasible since the inverted data may notcomprise a valid code word.

To increase storage reliability, in some embodiments, the storagecircuitry protects the data to be programmed using a suitable encodingscheme, which is typically implemented by ECC unit 50.

FIG. 2 is a diagram that schematically illustrates a code word 70, inaccordance with an embodiment of the present invention. In the exampleof FIG. 2, code word 70 comprises data bits 74 (e.g., LSB or CSB data inthe first phase), an inversion bit 78, inner code parity bits 82, andouter code parity bits 86. In the present example, parity bits 86comprise a LDPC code, which ECC unit 50 applies together to data bits74, inversion bit 78, and inner code parity bits 82. Thus, theaggregation of data bits 74, inversion bit 78, inner code parity bits82, and outer code parity bits 86 comprises a LDPC code word. Further inthe example of FIG. 2, parity bits 82 comprise a CRC or BCH code, whichECC unit 50 applies data bits 74 and to inversion bit 78. In thedescribed configuration, the LDPC outer code can correct errors in innercode parity bits 82, which enables to use the inner code for earlytermination of the LDPC decoding iterations, or for clearing residualerrors following outer decoding, as explained below.

The configuration of FIG. 2 is an exemplary configuration, which isshown purely for the sake of conceptual clarity, and other suitableconfigurations can also be used. For example, other suitable codes,coding schemes, and sizes and ordering of the different elements of codeword 70, can also be used.

In some embodiments, inner code 82 (e.g., comprising a CRC or BCH code)can be used, for example, in conjunction with LDPC code 86, to recognizeconditions for early termination while iteratively decoding the LDPCcode word, or to detect and mitigate trapping-set scenarios in the LDPCdecoder. As another example, when the inner code comprises an errorcorrecting code (e.g., BCH), code 82 can be used for mitigating residualerrors (“error floor”) remaining at the output of the LDPC decoder. U.S.patent application Ser. No. 12/913,815, filed Oct. 28, 2010, which isassigned to the assignee of the present patent application and whosedisclosure is incorporated herein by reference, describes severalmethods for performing early termination during iterative decoding.

In some embodiments, the storage circuitry initially sets inversion bit78 to “0”, and optionally inverts or bit-flips the entire code word 70to ensure sufficient level population of cells in the levels to be splitas described above. When reading the data, the storage circuitryretrieves the code word from array 28, and applies decoding using ECCunit 50. If decoded bit inversion 78 equals “1” the storage circuitryflips the data bits of the code word back, before delivery of bits 74 tothe host. For the decoding to work properly, however, each inverted codeword should also comprise a valid code word. In other words, each validcode word of the coding scheme should be mapped by inversion to anothervalid code word. By including the requirement that each row of theparity check matrix of the code has an even weight (i.e., the rowcomprises an even number of non-zero elements), LDPC codes can bedesigned to support the property that for each valid code word,bit-flipping results in another valid code word. This property, however,is hard or impossible to achieve in CRC and BCH codes. In thedescription that follows, we assume that the outer code (e.g. LDPC)supports the abovementioned property of the validity of inverted validcode words.

We now describe several methods for decoding code word 70, and decidingwhether it was inverted before storing and therefore should be invertedback. In the disclosed embodiments, inner code 82 comprises a code thatdoes not guarantee the validity of respective bit-flipped code words. Inthe description that follows X denotes a CRC or BCH code word. Forexample X may comprise data bits 74, inversion bit 78, and parity bits82. Additionally, let ˜X denote the bit-flipped version of X, and CRC(X)or BCH(X) denote the decoding operation. Also, ZEROS and ONES denoteall-“0” and all-“1” bit sequences, respectively. In the context of thepresent patent application and in the claims, inner code decoding refersto both error detection and error correction codes.

We first describe several embodiments in which inner code 82 comprisesan error detection code. Although the description mainly relates toembodiments that employ CRC coding, any other suitable error detectioncodes can also be used, such as, for example, a BCH code that isconfigured to operate in error detection mode. According to a propertyof error detection codes, if X is error free then CRC(X)=ZEROS, and onthe other hand, the probability that applying CRC decoding to anerroneous code word should result in ZEROS is very low.

In one embodiment, ECC unit 50 applies two CRC decode operations, namelyCRC(X) and CRC(˜X) (possibly in parallel). If CRC(X)=ZEORS, the storagecircuitry regards code word 70 as stored un-inverted. If on the otherhand CRC(˜X)=ZEROS, code word 70 is assumed inverted. Otherwise (i.e.,when none of the two CRC decoders produce the ZEROS result), thecriteria for early termination of the LDPC iterative decoder is not yetfulfilled.

In another embodiment, ECC unit 50 performs only one CRC decoding basedon the value of inversion bit 78. If the inversion bit indicates noinversion (“0”), ECC unit 50 decodes CRC(X). Otherwise the bit indicatesthat the code word was inverted and ECC unit 50 decodes CRC(˜X). ECCunit 50 may perform early termination of the LDPC decoding iterations ifthe respective CRC decoding result equals ZEORS.

In yet another embodiment, the decoding scheme relies on the inner codebeing a linear code. According to the linearity property,CRC(˜X+ONES)=CRC(˜X)+CRC(ONES), wherein “+” denotes bitwise XOR. Since,however, X=˜X+ONES, we conclude that ZEROS=CRC(X)=CRC(˜X)+CRC(ONES). Inthe example embodiment, ECC unit 50 performs CRC decoding and checkswhether the result is equal to CRC(ONES) or to ZEORS, to identifywhether the code word was inverted, or not, respectively. Note that foreach different inner code, the value CRC(ONES) needs to bepre-calculated and stored only once.

In the embodiments described above, ECC unit 50 may (on rare occasions)encounter a conflict between the result of the CRC(•) decoding and thedecoded value of bit inversion 78. Additionally, the outcomes ofapplying CRC(X) and CRC(˜X) may not always result in a conclusivedecision whether to invert the read data or not. In such occurrences,ECC unit is provided with a suitable indication. ECC unit 50 may use anysuitable decoding method when such a conflict or inconclusive conclusionoccurs. For example, ECC unit 50 may decide not to terminate the LDPCiterative decoder.

Some of the embodiments that are described above in the context of errordetection codes are applicable to error correction codes as well.

We now describe an embodiment, in which inner code 82 comprises an errorcorrection code such as BCH (configured to error correction operatingmode). ECC unit 50 applies two decoding operations, namely BCH(˜X) andBCH(X). If only one of ˜X or X is decodable, i.e., decodes an error-freeresult, the storage circuitry regards code word 70 as bit-flipped, ornot, respectively. If both ˜X and X are decodable, or both fail togenerate an error free result, then some other criterion can be used todetermine the inversion status, for example, based on the one having(following decoding) the least number of errors. Other criteria include,for example, consistency with the inversion bit after decoding, or theweight of the error pattern. In Alternative embodiments, ECC unit 50indicates an inconclusive or multiple-decoding result. In embodiments inwhich the inner error correcting code is used for “error floor”scenarios, the inner code decoder rarely needs to be applied, andtherefore decoding BCH twice (per code word) creates only a smallcomputational increase.

In the embodiments described above, we generally assume that in theouter code, inverted valid code words are mapped into other valid codewords. In other embodiments, in which this property is not guaranteed,decoding schemes similar to those described above for the inner code canbe applied for the outer code as well.

Reading Data Stored in the Second Programming Phase

FIGS. 3A and 3B are graphs showing the distribution of programminglevels used for storing data with a non-integer number of bits per cell,in accordance with embodiments of the present invention. Each of FIGS.3A and 3B is divided into upper and lower parts, showing the programminglevels and respective cell occupancies after the first and secondprogramming phases, respectively.

In the disclosed embodiments, according to FIGS. 3A and 3B, we assume anunderlying TLC device, whose memory cells 32 are programmed in the firstphase using four levels, out of which two levels are further split inthe second phase. Since each cell stores two bits of information afterthe first phase, and half of the cells are programmed to store anadditional bit in the second phase, the device ultimately stores 2.5bits/cell on average (using six out of the eight TLC levels).

In FIG. 3A, L0, L1, L3, and L5 denote the four levels to which memorycells 32 can be programmed in the first phase. Each of the levels L0,L1, L3, and L5 is mapped to a respective bit-pair combination, i.e.,“11”, “10”, “00”, and “01”, respectively. In each such bit-paircombination, individual bits correspond to separate data streams orpages. In the description that follows, the left bit corresponds to aLSB page bit, and the right bit to a CSB page bit (i.e., “10” meansLSB=“1” and CSB=“0”).

In the second programming phase, only cells that have been programmed inthe first phase to level L1 or L3 are further programmed with anadditional bit (MSB). Note that since according to the selected bits tolevel mapping, the CSB bit equals “1” at levels L0 and L5, and “0” atlevels L1 and L3, the cells at levels L1 and L3 can be identified byinspecting only the CSB bit. This property also simplifies MSB datareading as explained below.

As shown in FIG. 3A, programming the additional bit splits thepopulation of cells at L1 so that about half of the cells remain at L1and the remaining half of cells are programmed to L2. Similarly,approximately half the cells at L3 are programmed to L4 whereas thecells of the other half remain unchanged at L3. Thus, cells programmedin the second phase to one of the levels L1, L2, L3, and L4, storethree-bit information according to the respective bit assignment “100”,“101”, “001”, or “000”. In each such bit-triplet, the left, middle, andright bit corresponds to a respective separate data stream, e.g., a LSB,CSB, or MSB data page. Since the levels L0 and L5 are not programmed inthe second phase, the respective bit-triplet assigned to these levels isdenoted “11x” or “01x”, in which “11” and “01” are the former bit-paircombination (from the first phase) and the rightmost “x” denotes thenon-programmed additional bit.

We now describe several methods for reading data stored in a TLC deviceusing the configurations of the programming levels depicted in FIGS. 3Aand 3B. As described below, unlike conventional methods in which boththe LSB and CSB data should be read in order to identify the cells thatwere programmed with an additional bit, some of the disclosed methodsenable to identify the cells programmed with MSB data by initiallyreading only the CSB or LSB data.

In an embodiment, with relation to FIG. 3A, to read the MSB page, thestorage circuitry first identifies the memory cells that whereprogrammed with an additional bit in the second phase, i.e., programmedto levels L1 . . . L4. The storage circuitry first reads, and appliesECC decoding, to each of the LSB and CSB pages, and identifies memorycells that store the bit values “10” or “00” in the leftmost bit-pair ofthe bit-triples. In another embodiment, the storage circuitry reads andECC decodes only the CSB data, using the read thresholds TH_CSB_LO andTH_CSB_HI (in FIG. 3A) in a single read command. The configuration ofprogramming levels and bits to level mapping as shown in FIG. 3A enablesthe storage circuitry to refrain from unnecessary operations of read anddecode that would result by reading both the LSB and CSB data.

The storage circuitry then identifies the cells whose CSB bit equals“0”. To read the data written in the identified cells (e.g., MSB data),the storage circuitry uses, for example, two read thresholds (not shown)so that one threshold is positioned between L1, and L2 and the otherthreshold between L3 and L4.

In FIG. 3B, the levels L0, L1, L2, and L4 are mapped, in the firstphase, to respective bit-pairs “11”, “10”, “00” and “01”. In the secondphase, the storage circuitry programs an additional bit only to memorycells that have been programmed in the first phase to L2 or L4. Thus,the level of about half the cells at L2 is shifted to L3, and the levelof half the cells at L4 is shifted to L5. The L2, L3, L4, and L5 levelsare mapped to respective bit-triples “001”, “000”, “010”, and “011”. Thelevels L0 and L1 are not programmed in the second phase and are mappedto the respective bit-triplets “11x” and “10x”.

In some embodiments, similarly to the description in FIG. 3A above, theleft, middle, and right bits correspond to respective LSB, CSB, and MSBdata pages. In an embodiment, to read the MSB data, the storagecircuitry identifies the cells programmed with an additional bit byfirst reading and decoding only the LSB page (as opposed to read anddecode of both the LSB and CSB pages), using a single read thresholddenoted TH_LSB in FIG. 3B. This embodiment is advantageous over the oneof FIG. 3A above (in which the reading requires two read thresholds),since a larger number of read thresholds typically increases the pagereading time. Moreover, similarly to the method of FIG. 3A, only tworead thresholds are required for reading the MSB data. The storagecircuitry then reads the MSB data from the identified cells using tworead thresholds, one positioned between L2 and L3, and the other betweenL4 and L5. By using the configuration of programming levels and bits tolevel mapping shown in FIG. 3B, the storage circuitry can efficientlyread the MSB page and refrain from unnecessary read and decodeoperations that would result by reading both the LSB and CSB data.

As can be seen from the description and figures above, programming theadditional bit in the second phase typically creates non-uniform celloccupancy among the different levels. For example, the number of cellsprogrammed to each of the levels L2 . . . L5 in FIG. 3B, is about halfthe number of cells programmed to L0 or L1. As shown in FIG. 3B, thethreshold voltage (V_(TH)) spacing or separation among the levels andthe cell occupancy in each level (among other factors) affect the amountof overlapping between the distributions of adjacent levels. Since thisoverlapping is closely related to reading error probabilities, uniformspacing among the differently cell-occupied levels may result innon-uniform (and non-optimal) read error probabilities across thelevels.

In some embodiments, the threshold voltages assigned to the differentprogramming levels are set so as to achieve uniform read errorprobabilities across all the levels, based on the cell occupancies ofthe levels. To compensate for different cell occupancies, the distance(i.e., threshold voltage difference) between adjacent highly populatedlevels should be set larger than the distance between adjacent lesspopulated levels.

In the example configuration of FIG. 3B, ΔL01 denotes the voltagedifference between L0 and L1, and ΔL23, ΔL34, and ΔL45 denote thevoltage differences between L2-L3, L3-L4, and L4-L5, respectively. In anembodiment, by adjusting the spacing, based on level occupancy, so thatΔL01 is larger than each of the differences ΔL23, ΔL34, and ΔL45 (whichare assumed similar in the present example), the storage circuitryachieves uniform read error probabilities across the programming levels.Additionally, the spacing between L1 and L2, should be configured to belarger than ΔL23, ΔL34, and ΔL45, but smaller than ΔL01.

In some embodiments, the storage circuitry may additionally determinethe voltage spacing among the programming levels based on factors otherthan level occupancies. For example, U.S. Pat. No. 7,925,936, filed Jul.11, 2008, whose disclosure is incorporated herein by reference,describes several methods for achieving uniform read error probabilitiesacross the programming levels by adjusting the spacing among the levelsto compensate for different number of read operations performed inreading pages of different bit significance.

The configurations of FIGS. 3A and 3B are exemplary configurations,which are shown purely for the sake of conceptual clarity and othersuitable configurations can also be used. For example, in alternativeembodiments, other programming levels, number of levels, level splittingschemes, bits to level mapping, reading thresholds, and/or spacing amongthe levels can also be used.

Storing Data in the Second Phase at Known Offsets

Consider, for example, storing data in a TLC device using sevenprogramming levels. In some embodiments, the storage circuitry storesthe data using suitable variants of the two-phase programming methoddescribed above. In an example embodiment, the storage circuitry stores,in the first phase, LSB and CSB data using four levels as shown, forexample in the upper part of FIG. 3A. Thus, in the present example,three levels, e.g., L0, L1, and L3 in the upper part of FIG. 3A, are tobe split in the second phase.

In some embodiments, the storage circuitry separately encodes datastreams denoted LSB, CSB, and MSB data in code words, such as, forexample, code word 70. In an embodiment, the storage circuitry programsmemory cells 32 in groups of N cells, and also encodes data for storagein N-bit code words as described herein. In the description thatfollows, the term “cell-group” or just group, refers to a group of Ncells that are programmed simultaneously. Note that although we assumethat the stored data is subject to ECC encoding in respective codewords, the disclosed methods are also applicable to storing rawnon-encoded data.

Using four programming levels, the storage circuitry writes (in thefirst phase) the N-bit LSB and CSB code words. As explained furtherbelow, in each cell-group the number of available cells is less than N,but in the first phase, the storage circuitry guarantees that thisnumber exceeds 0.75·N (typically by a small amount). Therefore, althougha complete MSB code word cannot be stored in a single cell-group, threeN-bit code words can be stored among four cell-groups.

In Table 1 below, we demonstrate a technique for dividing three N-bitcode words among four cell-groups. In Table 1, MSB0 . . . MSB2 denotethe MSB code words and CW0 . . . CW3 denote the cell-groups. The entriesin Table 1 depict the number of bits taken from each code word andwritten to the available cells in a respective cell-group. For example,0.25·N bits from MSB0 and 0.5·N bits from MSB1 are programmed in CW1. Asanother example, the MSB1 bits are divided in half between CW1 and CW2.

TABLE 1 Dividing code words bits among cell-groups MSB0 MSB1 MSB2 CW00.75 · N 0 0 CW1 0.25 · N 0.5 · N 0 CW2 0 0.5 · N 0.25 · N CW3 0 0 0.75· N

In some embodiments, if necessary, the storage circuitry preprocessesthe data in the first phase by inverting the LSB, CSB, or both codewords to guarantee that there are at least 0.75·N cells available forstoring the MSB data in the respective cell-group. The group ofavailable cells can be partitioned into two complementary subgroups suchthat one subgroup comprises 0.75·N cells and the other subgroupcomprises the remaining cells, which are referred to as “extra cells.”Since the cell occupancies in each of the four levels in the first phasedepend on the actual data stored, the number of extra cells is also datadependent.

Various configurations can be used for dividing the bits of three MSBcode words among four cell-groups. Table 1 above presents one suchexample, whereas additional examples are described below. In anembodiment, each code word is divided into two segments, which arestored in two different cell-groups at certain offsets among theavailable cells. The storage circuitry stores the segments of the codewords MSB0 . . . MSB2 continuously among CW0 . . . CW3, using up all theavailable cells in each cell-group. Let Ni denote the number ofavailable cells in the cell-group CWi, and Ei denote the number ofrespective extra cells.

In this embodiment, the segments of the code words are stored atvariable offsets among the available cells. Note that in the currentcontext, offsets are measured only among the available cells in eachcell-group. Thus, for example, zero offset refers to the first availablecell in a cell-group. To read a given MSB code word, the storagecircuitry needs to evaluate the respective offsets at which the segmentswere stored, by reading the low significance data from cell-groups inwhich segments of other code words are stored.

For example, in the present embodiment, the storage circuitry storesN0=0.75·N+E0 of the MSB0 bits in CW0 at zero offset (i.e., firstsegment), and the remainder of the MSB0 bits (i.e., second segment) inCW1 at zero offset. The storage circuitry then stores the first MSB1segment in CW1 immediately following the MSB0 second segment, i.e.,starting at offset N−N0=0.25·N−E0.

When reading the MSB1 first segment, the storage circuitry shouldtherefore first read and decode the LSB and CSB data stored in CW0,identify and count the number of available cells N0, calculateE0=N0−0.75·N, and use E0 to evaluate the actual offset of the first MSB1segment (or equivalently calculate N−N0). Similar arguments holdregarding reading the segments of the MSB2 code word. Thus, in thisexample, reading the MSB1 segments, which are stored in CW1 and CW2,involves reading data stored in another cell-group (i.e., CW0) as well.

In alternative embodiments, which are described below, the storagecircuitry stores the MSB segments at known offsets among the availablecells. This enables efficient reading of the MSB data, since with knownoffsets, reading a given MSB code word require reading only data storedin the cell-groups in which the segments of that code word are stored.

FIGS. 4A and 4B are diagrams that schematically illustrate twotechniques for storing data at known offsets among available memorycells. Consider writing three N-bit MSB code words denoted MSB0, MSB1,and MSB2, in four cell-groups denoted CW0 . . . CW3. As described above,in the seven-level TLC example, each of the four cell-groups comprisesrespective number of Ni=0.75·N+Ei available cells, of which Ei comprisethe extra cells.

In FIG. 4A, each code word MSBi (i=0 . . . 3), is divided into twosegments denoted MSBi_A and MSBi_B, each having a known predefined size.The MSB0_A segment comprises 0.75·N bits and is stored in CW0 at zerooffset. The MSB0_B segment, which comprises 0.25·N bits is stored in CW1also at zero offset. The MSB1 segment is divided into the MSB1_A andMSB1_B segments, having 0.5·N bits each. The MSB1_A segment is stored inCW1 following the MSB0_B bits, i.e., at a known offset of 0.25·N cells.The MSB1_B segment is stored in CW2 at zero offset, creating a knownoffset of 0.5·N cells for storing the MSB2_A first segment, whichcomprises 0.25·N bits. The MSB2_B second segment comprises 0.75·N bitsand is stored in CW3 at zero offset. Table 2 summarizes the allocationof the MSB segments among the cell-groups CW0 . . . Cw3 as shown in FIG.4A.

TABLE 2 Allocating code words at known offsets according to FIG. 4ASEGMENT STORED IN SEGMENT SIZE CELL-GROUP OFFSET MSB0_A 0.75 · N CW0 0MSB0_B 0.25 · N CW1 0 MSB1_A  0.5 · N CW1 0.25 · N MSB1_B  0.5 · N CW2 0MSB2_A 0.25 · N CW2 0.5 · N MSB2_B 0.75 · N CW3 0

In FIG. 4B, the first segment of each MSB code word is written at aknown offset, and using up all the available cells. Remaining bits ofthe code word (i.e., the second segment) are written in anothercell-group at zero offset. Although each MSBi code word is divided intosegments MASBi_A and MSBi_B whose size depends on Ei, the segments arestill positioned at known fixed offsets. Table 3 summarizes theallocation of the MSB code word segments, among the respectivecell-groups according to FIG. 4B.

TABLE 3 Allocating code words among cell-groups according to FIG. 4BSEGMENT STORED IN SEGMENT SIZE CELL-GROUP, OFFSET MSB0_A 0.75 · N + E0CW0 0 MSB0_B 0.25 · N − E0 CW1 0 MSB1_A  0.5 · N + E1 CW1 0.25 · NMSB1_B  0.5 · N − E1 CW2 0 MSB2_A 0.25 · N + E2 CW2 0.5 · N MSB2_B 0.75· N − E2 CW3 0

In the embodiments described above, all the code words, including theMSB code words share a common size of N bits. On one hand, thissimplifies the encode/decode and write/read operations and relatedcircuitry. On the other hand, however, each N-bit MSB code word needs tobe stored in more than a single cell-group as described above. In analternative embodiment, the MSB code words comprise only 0.75·N bits(referred to as short MSB code words). Since each N-cell group comprisesNi≧0.75·N available cells, short MSB code words always fit in acell-group. The coding scheme, however, of the short MSB code words isdifferent from the coding scheme of the N-bit code words and should useother partitioning of the data and parity bits. As a result, ECC unit 50may comprise separate dedicated encoder/decoder for the short MSB codewords.

FIG. 5 is a flow chart that schematically illustrates a method forwriting MSB data at known offsets among available memory cells, inaccordance with an embodiment of the present invention. The method inFIG. 5 is aligned with the MSB data allocation among the cell-groups asshown in FIG. 4B. When the method starts, it is assumed that the storagecircuitry has already performed the first programming phase, in whichthe LSB and CSB data are written in CW0 . . . CW3, and that the threecode words MB0 . . . MB2 are ready to be programmed. The method beginswith the storage circuitry identifying, in each cell-group CWi, thecells that are available for programming MSB data, at a cellidentification step 200. Let Ni denote the number of available cells inCWi, and Ei=N−Ni denote the number of respective extra cells. The methodthen proceeds to a MSB0 programming step 204. At step 204, the storagecircuitry programs the first 0.75·N+E0 bits of MSB0 in CW0 at zerooffset, to use up all the available CW0 cells. The storage circuitrythen programs the remaining 0.25·N−E0 bits of MB0 is CW1 at zero offset.Next, the storage circuitry programs the MSB1 and MSB2 code words, atrespective steps 208 and 212. The storage circuitry writes MSB1 atoffset 0.25·N in CW1 and continues in CW2. Similarly, the storagecircuitry writes MSB2 in CW2 at offset 0.5·N and the remaining MSB2 bitsin CW3 at zero offset.

FIG. 6 is a flow chart that schematically illustrates a method forreading MSB data, which was written at known offsets among availablememory cells, in accordance with an embodiment of the present invention.The method begins with the storage circuitry identifying cells which areprogrammed with MSB data at an identifying programmed cells step 250. Asevident, for example from Table 3, to independently read only one of theMSB0, MSB1, or MSB2 code words, it is sufficient to identify the cellsthat are programmed with an additional bit only in {CW0 and CW1}, {CW1and CW2}, or {CW2 and CW3}, respectively. To read MSB0, MSB1, or MSB2,the storage circuitry proceeds to respective reading step 254, 258, or262. At step 254, the storage circuitry reads all the available cells inCW0 (i.e., N0=0.75·N+E0 bits) into a temporary segment denoted MSB0_A.The storage circuitry then counts the number of read bits N0, calculatesE0=N0−0.75·N, and reads the first 0.25·N−E0 bits from the availablecells of CW1 into a temporary segment denoted MSB0_B. The storagecircuitry then concatenates the two temporary segments to generate thecomplete MSB0 code word. At reading steps 258 and 262, the storagecircuitry similarly reads the MSB1 or MSB2 code words with suitablesegment sizes and offsets according to FIG. 4B and Table 3.

The configuration of FIGS. 4A, 4B, 5 and 6 is an exemplaryconfiguration, which is shown purely for the sake of conceptual clarity,and other suitable configurations can also be used. For example, othersuitable numbers of code words and cell-groups can also be used. Asanother example, other ordering schemes of the code words segments amongthe cell-groups can be selected, such as, for example, swapping betweenMSB2_A and MBS0_B or MSB1_B.

In the embodiments described in FIGS. 4A, 4B, 5 and 6, during the secondphase, the extra cells are typically skipped. In alternativeembodiments, however, the storage circuitry can use the extra cells tostore user, storage management, and/or any other type of data.

It will be appreciated that the embodiments described above are cited byway of example, and that the present invention is not limited to whathas been particularly shown and described hereinabove. Rather, the scopeof the present invention includes both combinations and sub-combinationsof the various features described hereinabove, as well as variations andmodifications thereof which would occur to persons skilled in the artupon reading the foregoing description and which are not disclosed inthe prior art. Documents incorporated by reference in the present patentapplication are to be considered an integral part of the applicationexcept that to the extent any terms are defined in these incorporateddocuments in a manner that conflicts with the definitions madeexplicitly or implicitly in the present specification, only thedefinitions in the present specification should be considered.

The invention claimed is:
 1. A method for data storage, comprising:storing data in a group of memory cells, by encoding the data using atleast an outer code and an inner code, and optionally inverting theencoded data prior to storing the encoded data in the memory cells; andreading the encoded data from the memory cells; applying inner codedecoding to the read encoded data, to produce a decoding result; andconditionally inverting at least part of the read data, depending on thedecoding result of the inner code.
 2. The method according to claim 1,wherein the inner code comprises a code in which inversion of a validcode word does not always result in another valid code word, and whereinapplying the inner code decoding comprises decoding at least one of theread encoded data and an inverted version of the read encoded data. 3.The method according to claim 2, wherein applying the inner codedecoding comprises decoding both the read encoded data and the invertedversion of the read encoded data, and wherein conditionally invertingthe at least part of the read data comprises inverting the at least partof the read data only when the decoding result of the inverted versionis error free and the decoding result of the read encoded data is noterror free.
 4. The method according to claim 2, wherein storing the datacomprises storing with relation to the data an inversion indication ofwhether the stored data has been inverted, wherein reading the encodeddata comprises reading and decoding the inversion indication, andwherein applying the inner code decoding comprises decoding only theread encoded data or only the inverted version of the read encoded data,depending on the inversion indication.
 5. The method according to claim4, wherein conditionally inverting the at least part of the read datacomprises indicating inability to decide whether to invert the readdata, when the decoding result of the read encoded data contradicts theinversion indication.
 6. The method according to claim 2, wherein theinner code comprises an error detection code, and wherein conditionallyinverting the at least part of the read data comprises inverting the atleast part of the read data when the decoding result is equal to aresult of applying the inner code decoding to an all-ones word, and notinverting the at least part of the read data when the decoding result iserror free.
 7. The method according to claim 2, wherein conditionallyinverting the at least part of the read data comprises indicatinginability to decide whether to invert the read data or not, when thedecoding result of the read encoded data contradicts the decoding resultof the inverted version of the read encoded data.
 8. An apparatus fordata storage, comprising: a memory, which includes an array of memorycells; and storage circuitry configured to: store data in a group of thememory cells, by encoding the data using at least an outer code and aninner code and optionally inverting the encoded data prior to storingthe encoded data in the memory cells; read the encoded data from thememory cells; apply inner code decoding to the read encoded data toproduce a decoding result; and conditionally invert at least part of theread data depending on the decoding result of the inner code.
 9. Theapparatus according to claim 8, wherein the inner code comprises a codein which inversion of a valid code word does not always result inanother valid code word, and wherein the storage circuitry is configuredto decode at least one of the read encoded data and an inverted versionof the read encoded data.
 10. The apparatus according to claim 9,wherein the storage circuitry is configured to decode both the readencoded data and the inverted version of the read encoded data, and toinvert the at least part of the read data only when the decoding resultof the inverted version is error free and the decoding result of theread encoded data is not error free.
 11. The apparatus according toclaim 9, wherein the storage circuitry is configured to store withrelation to the data an inversion indication of whether the stored datahas been inverted, to read and decode the inversion indication, and todecode only the read encoded data or only the inverted version of theread encoded data, depending on the inversion indication.
 12. Theapparatus according to claim 11, wherein the storage circuitry isconfigured to indicate inability to decide whether to invert the readdata, when the decoding result of the read encoded data contradicts theinversion indication.
 13. The apparatus according to claim 9, whereinthe inner code comprises an error detection code, and wherein thestorage circuitry is configured to invert the at least part of the readdata when the decoding result is equal to a result of applying the innercode decoding to an all-ones word, and to not invert the at least partof the read data when the decoding result is error free.
 14. Theapparatus according to claim 9, wherein the storage circuitry isconfigured to indicate inability to decide whether to invert the readdata or not, when the decoding result of the read encoded datacontradicts the decoding result of the inverted version of the readencoded data.
 15. The method of claim 1, wherein the inner code includesa Bose-Chaudhuri-Hocquenghem (BCH) code.
 16. The method of claim 15,wherein the outer code includes a Low Density Parity Check (LDPC) code.17. The apparatus of claim 8, wherein the inner code includes aBose-Chaudhuri-Hocquenghem (BCH) code.
 18. The apparatus of claim 17,wherein the outer code includes a Low Density Parity Check (LDPC) code.